package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Reemzpwv type
*/
@SuppressWarnings("ALL")
public class Reemzpwv {


        private static volatile Reemzpwv instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Reemzpwv getInstance() {
            if (instance == null) {
                synchronized (Reemzpwv.class) {
                    if (instance == null) {
                        instance = new Reemzpwv();
                    }
                }
            }
            return instance;
        }


        private Reemzpwv() {

        }



    public  Boolean judgeBdyajdzzdu(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeKmoauyofgw(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeBcobknljtn(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeIjpucqvkme(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeZmxldwkulb(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeZvawfmqysm(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeWyhktxyrod(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeOonxoumqqz(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  bdyajdzzdu;
    private String  kmoauyofgw;
    private String  bcobknljtn;
    private String  ijpucqvkme;
    private String  zmxldwkulb;
    private String  zvawfmqysm;
    private String  wyhktxyrod;
    private String  oonxoumqqz;


    public void setBdyajdzzdu(String bdyajdzzdu){
    this.bdyajdzzdu = bdyajdzzdu;
    }

    public String getBdyajdzzdu(){
    return this.bdyajdzzdu;
    }
    public void setKmoauyofgw(String kmoauyofgw){
    this.kmoauyofgw = kmoauyofgw;
    }

    public String getKmoauyofgw(){
    return this.kmoauyofgw;
    }
    public void setBcobknljtn(String bcobknljtn){
    this.bcobknljtn = bcobknljtn;
    }

    public String getBcobknljtn(){
    return this.bcobknljtn;
    }
    public void setIjpucqvkme(String ijpucqvkme){
    this.ijpucqvkme = ijpucqvkme;
    }

    public String getIjpucqvkme(){
    return this.ijpucqvkme;
    }
    public void setZmxldwkulb(String zmxldwkulb){
    this.zmxldwkulb = zmxldwkulb;
    }

    public String getZmxldwkulb(){
    return this.zmxldwkulb;
    }
    public void setZvawfmqysm(String zvawfmqysm){
    this.zvawfmqysm = zvawfmqysm;
    }

    public String getZvawfmqysm(){
    return this.zvawfmqysm;
    }
    public void setWyhktxyrod(String wyhktxyrod){
    this.wyhktxyrod = wyhktxyrod;
    }

    public String getWyhktxyrod(){
    return this.wyhktxyrod;
    }
    public void setOonxoumqqz(String oonxoumqqz){
    this.oonxoumqqz = oonxoumqqz;
    }

    public String getOonxoumqqz(){
    return this.oonxoumqqz;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}